﻿using Common;
using DAL.AntiFake;
using Model.AntiFake;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BLL.AntiFake
{
    public class QueryCodeLogBLL
    {
        QueryCodeLogDAL dal = new QueryCodeLogDAL();


        #region 分页数据
        /// <summary>
        /// 分页数据
        /// </summary>
        /// <param name="model"></param>
        /// <param name="pager"></param>
        /// <returns></returns>
        public DataTable GetPagerList(ref PagerModel pager, string key)
        {
            return dal.GetPagerList(ref pager, key);
        }
        #endregion

        #region 获取单个model
        public QueryCodeLogModel GetModel(int id)
        {
            return dal.GetModel(id);
        }
        #endregion

        #region 增
        /// <summary>
        /// 插入地址
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public Common.ResultEntity Insert(QueryCodeLogModel model)
        {

            return dal.Insert(model);
        }
        #endregion

        #region 改
        public Common.ResultEntity Update(QueryCodeLogModel model)
        {
            return dal.Update(model);
        }
        #endregion

        #region 删除
        public Common.ResultEntity Delete(int? ID)
        {
            return dal.Delete(ID);
        }
        #endregion

        #region 详细查询
        public DataTable GetPagerListSel(ref PagerModel pager,QueryCodeLogModel_Sel modelSel)
        {
            return dal.GetPagerListSel(ref pager, modelSel);
        }
        #endregion

        #region  数据导出Excel
        public DataTable GetPagerListExcel(string orderSort)
        {
            return dal.GetPagerListExcel(orderSort);
        }
        #endregion

        ////////////////////////////////////////////////////异常查询统计////////////////////////////////////////////////////////////////////////////////
        public DataTable GetPagerListAnomaly(ref PagerModel pager, string key) {
            return dal.GetPagerListAnomaly(ref pager,key);
        }

        #region 异常查询 数据导出Excel
        public DataTable GetPagerListAnomalyExcel(string orderSort)
        {
            return dal.GetPagerListAnomalyExcel(orderSort);
        }
        #endregion

        #region 异常查询 详细查询
        public DataTable GetPagerListAnomalySel(ref PagerModel pager, QueryCodeLogAnomaly_Sel modelSel)
        {
            return dal.GetPagerListAnomalySel(ref pager, modelSel);
        }
        #endregion


        #region 异常查询 详细查询
        public DataTable  GetCode( string code)
        {
            try
            {
                string key = AppConst.DigitCodeKey;
                string strCode = MiMa.Jiemi(code, key);
                string tbl =strCode.Substring(0, 6);
                return dal.GetCode(tbl, strCode);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        #endregion

        public DataTable GetCodeLogDis(string code)
        {
           string key = AppConst.DigitCodeKey;
           string codeStr= MiMa.Jiemi(code, key);
           return dal.GetCodeLogDis(codeStr);
        }
        
    }
}
